/**
 * PaperResultListController.java
 * Version 1.0.0
 * Created on 2018年7月18日
 *
 */
package com.yincheng.oes.business.exam.judgepaper;

import java.util.List;

import org.apache.commons.lang3.tuple.Pair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yincheng.oes.business.util.Tools;
import com.yincheng.oes.business.util.dictionary.DictionaryService;
import com.yincheng.oes.sso.util.UserUtils;

/**
 * @author yangsy
 * @version 1.0.0
 * @since
 * 创建时间：2018年7月18日
 * 功能描述：我的评判试卷控制层
 * 邮箱地址：446948434@qq.com
 */
@Controller
@RequestMapping("/myExamList")
public class MyExamListController {

    @Autowired
    private PaperResultListService paperResultListService;

    @Autowired
    private DictionaryService dictionaryService;

    /**
     * 我的评卷成绩列表
     *
     * @param model
     * @return
     */
    @RequestMapping(value = "/examListPage.html", method = RequestMethod.GET)
    public String examListPage(Model model) {
        model.addAttribute("paperStatus", dictionaryService.getByModel("paper_status"));
        return "business/mygrade/mygradelist";
    }

    /**
     * 根据参数获取考试成绩列表数据
     *
     * @param bean
     * @return
     */
    @RequestMapping(value = "/getList.json", method = RequestMethod.GET)
    @ResponseBody
    public String list(QueryParamBean bean) {
        bean.setTeacherUid(UserUtils.getUser().getUserId());
        Pair<Integer, List<QueryResultRowBean>> pair = paperResultListService.getListByParam(bean);
        return Tools.toEasyuiDataGrid(pair.getLeft(), pair.getRight());
    }

}
